package com.android.fitcontrol;
/**
 * @author yzhadan
 * adapter fot exrsice list, which defines customizable view of list items
 */
import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleCursorAdapter;

public class ExerciseListAdapter extends SimpleCursorAdapter{
	
	private int[] colors;
	
	public ExerciseListAdapter(Context context, int layout, Cursor c, String[] from, int[] to){
		super(context, layout, c, from, to);
		colors = new int[]{context.getResources().getColor(R.color.white),
		context.getResources().getColor(R.color.gray)};
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		  View view = super.getView(position, convertView, parent);
		  int colorPos = position % colors.length;
		  view.setBackgroundColor(colors[colorPos]);
		  return view;
	}
	
}
